# -*- coding:utf-8 -*-
# __author__ : "张百科"
# Date: 2021/1/26 11:43
# File: construction.py
# IDE: PyCharm
from django.db import models
from utils.common import prefix
from utils.choices import construction_process,construction_layout

class Construction(models.Model):
    id = models.AutoField(db_column='ID', primary_key=True)  # Field name made lowercase.
    order_id = models.IntegerField()
    manager = models.CharField(max_length=20)
    community = models.CharField(max_length=20)
    room_num = models.CharField(max_length=50)
    owner = models.CharField(max_length=20)
    layout = models.CharField(choices=construction_layout,max_length=20)
    owner_tel = models.CharField(max_length=20)
    area = models.IntegerField()
    tel = models.CharField(max_length=20)
    process = models.IntegerField(choices=construction_process)
    flow = models.TextField()     #大字段 记录 阶段，施工人，完工时间，备注
    create_time = models.DateTimeField(auto_now=True)
    complete_images = models.TextField(blank=True, null=True)
    update_time = models.CharField(max_length=10, blank=True, null=True)
    is_done = models.IntegerField(default=0)
    is_public = models.IntegerField(default=0)
    is_typcal = models.IntegerField(blank=True, null=True,default=0)
    qa = models.TextField(db_column='QA', blank=True, null=True)  # Field name made lowercase.
    index_img_url = models.CharField(max_length=100, blank=True, null=True)
    title = models.CharField(max_length=100, blank=True, null=True)
    graph_image_url = models.CharField(max_length=100, blank=True, null=True)
    read_count = models.IntegerField(default=0)
    cost = models.DecimalField(max_digits=10, decimal_places=2, blank=True, null=True)
    cost_details = models.TextField(blank=True, null=True)
    is_delete = models.TextField(default=0)

    class Meta:
        managed = False
        db_table = prefix+'construction'